{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6c322f47-16f5-450a-91aa-fe932d7ce83c",
   "metadata": {},
   "outputs": [],
   "source": [
    "def nop(): \n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1304934e-d765-43d0-8af1-424b27d31134",
   "metadata": {},
   "outputs": [],
   "source": [
    "nop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "957d4d38-4a63-42a3-adf2-48c66eb601f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "age = 20\n",
    "if age >= 18: \n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a14561b8-663a-422e-a3a8-5b11ccea07ab",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calc(*numbers): \n",
    "    sum = 0\n",
    "    for n in numbers: \n",
    "        sum = sum + n * n \n",
    "    return sum \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "408abaf2-a813-495b-b60e-dc4e776f817f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calc(1, 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "9d22e189-8aeb-4129-854e-d4bfee177754",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calc(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "a02bfd89-b7b2-414a-80de-7605851e1b46",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "165"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calc(1, 3, 5, 7 ,9)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "5f32381a-1482-4978-afa0-d7038d8a36ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nums = [1, 2, 3]\n",
    "calc(*nums)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "37c34885-2d9a-464a-b403-d3a1439b8b6e",
   "metadata": {},
   "outputs": [],
   "source": [
    "def person(name, age, **kw ):\n",
    "    print('name:', name, 'age:', age, 'other:', kw  )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "51ffebb0-a338-4d2a-aba2-2b3cd0ff2d6c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name: Bob age: 35 other: {'city': 'Beijing'}\n"
     ]
    }
   ],
   "source": [
    "person('Bob', 35, city='Beijing')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "91332246-0883-41cb-b7ca-cffaa12ff837",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name: Bob age: 35 other: {}\n"
     ]
    }
   ],
   "source": [
    "person('Bob', 35)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "03c8b962-97a8-45f0-84ff-72b410a2b3de",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name: Jack age: 24 other: {'city': 'Beijing'}\n"
     ]
    }
   ],
   "source": [
    "extra = {'city': 'Beijing', 'job': 'Engineer'}\n",
    "person('Jack', 24, city=extra['city'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "68f861b5-7755-4b2d-8a6e-cf3d9e382eb7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name: Jack age: 24 other: {'city': 'Beijing', 'job': 'Engineer'}\n"
     ]
    }
   ],
   "source": [
    "person('Jack', 24, **extra)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e607ac42-9c99-440c-939b-48a19f34bf09",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
